<?php
final class Singleton{
	
	
	private static $_registry = array();
	
	public static function register($key , $val){
		if(!self::has($key)){
			self::$_registry[$key] =  $val;
		}else{
			throw new Exception('This register key['.$key.'] already.');
		}
	}
	
	public static  function unegister($k){
		if(isset(self::$_registry[$k])){
			unset(self::$_registry[$k]);
		}
	}
	
	public static function getSingleton($k){
		if(!self::has($k)){
			throw new Exception('This register key['.$key.'] does not exist.');
		}
		return self::$_registry[$k];
	}
	
	public static function has($key){
		if(!isset(self::$_registry[$key]) ){
			return false;
		}
		return true;
	}
	public static function compareToClass($var){
		
	}
	
}